package code;

import java.util.Scanner;
public class King_day08 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long n=sc.nextLong();
            long m=sc.nextLong();
            long k=sc.nextLong();
            long result=kingroute(n,m,k);
            System.out.println(result);
        }
    }
    public static long kingroute(long n,long m,long k) {
        long minSteps=Math.max(n,m);
        if(k<minSteps){
            return -1;
        }
        if((k-minSteps)%2!=0){
            return -1;
        }
        return Math.min(n,Math.min(m,k-minSteps));
    }
}
